package com.huilian.iotbox.client.service.impl;

import com.huilian.iotbox.client.dao.BlackListDao;
import com.huilian.iotbox.client.service.BlackListService;
import com.huilian.iotbox.data.common.ServerResponse;
import com.huilian.iotbox.data.po.BlackList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * BlackListServiceImpl
 *
 * @Author mineChen
 * @Date 2021/11/27 上午 10:17
 */
@Service
public class BlackListServiceImpl implements BlackListService {

    @Autowired
    private BlackListDao blackListDao;

    /**
     * 校验当前会员状态，拉入黑名单的不许支付
     *
     * @param memberId
     * @return
     */
    @Override
    public ServerResponse checkMemberStateByMemberIdAndMerchantStoreId(Long memberId, Integer merchantStoreId) {
        BlackList blackList = blackListDao.queryByMerchantStoreId(merchantStoreId, memberId);
        if (!StringUtils.isEmpty(blackList)){
            return ServerResponse.createByErrorMessage("支付失败_1");
        }
        return ServerResponse.createBySuccess();
    }
}
